/**
 * #info
 *
 *@author   wuwg
 *@createTime   2018/03/20
 *@updateTime   2018/05/04
 *@description  menu-group  component  菜单组组件
 */
/**
 * #item
 *
 * @type        aty-menu-group
 * @cn            菜单组
 * @nameprop   text
 * @stPlugin    false
 * @stContainer false
 * @children     [aty-submenu,aty-menu-item]
 * @parents      [aty-menu,aty-submenu]
 */
import config from '../../../../config/config.js'

// mixins
import mixin from './../mixin/mixin.js'
// prefix
const prefixCls = config.prefix + '-menu'
export default {
  name: prefixCls + '-group',
  mixins: [mixin],
  props: {
    /**
     * #property
     *
     * @name      text
     * @cn        该组菜单的标题
     * @type      string
     * @description 该组菜单的标题
     */
    text: {
      type: String,
      default: ''
    },
    /**
     * #property
     *
     * @name icon
     * @cn   图标
     * @type icon
     * @description 该组菜单的标题的图标
     */
    icon: {
      type: String
    }
  },
  data () {
    return {
      prefixCls: prefixCls
    }
  },
  computed: {
    groupStyle () {
      return this.hasParentSubmenu && this.mode !== 'horizontal' ? {
        paddingLeft: 43 + (this.parentSubmenuNum - 1) * 28 + 'px'
      } : {}
    },
    iconClass () {
      return [
        config.prefix + '-img-icon'
      ]
    }
  },
  methods: {
    handleClick () {
      /**
       * #event
       *
       * @name    click
       * @param   item    当前点击的条目
       * @param   event    event对象
       * @body    console.log("menu-group被点击"+item);
       * @description   点击时触发
       */
      this.$emit('click', { text: this.text }, event)
    }
  }
}
